﻿using Microsoft.AspNetCore.Mvc.Filters;

namespace D.B.Data.API.Filter
{
    public class CustomExceptionFilter : IExceptionFilter
    {
        private readonly ILogger<CustomExceptionFilter> logger;

        public CustomExceptionFilter(ILogger<CustomExceptionFilter> logger)
        {
            this.logger = logger;
        }

        public void OnException(ExceptionContext context)
        {
            logger.LogError("【全局异常过滤器】" + context.Exception.Message);
        }
    }
}
